// import { createSelector } from "reselect"

// 初始化仓库
export const initState = {
    getNew: [],
    groupon:[],
    seckill:[],
    indexGoods:[],
}

export const reducer = (state, action) => {
    switch (action.type) {
        case "changeGetNew":
            return {
                ...state,
                getNew: action.arr
            }
        case "changeGroupon":
            return {
                ...state,
                groupon:action.arr
            }
        case "changeSeckill":
            return {
                ...state,
                seckill:action.arr
            }
        case "changeIndexGoods":
            return {
                ...state,
                indexGoods:action.arr
            }
        default:
            return state
    }
}

export const actions = {
    changeGetNew:(arr)=>({type:"changeGetNew",arr}),
    changeGroupon:(arr)=>({type:"changeGroupon",arr}),
    changeSeckill:(arr)=>({type:"changeSeckill",arr}),
    changeIndexGoods:(arr)=>({type:"changeIndexGoods",arr}),
}